//
//  SubCategory.m
//  ServiceApp
//
//  Created by User-23 on 12/15/14.
//  Copyright (c) 2014 TrainingCamp. All rights reserved.
//

#import "SubCategory.h"

@interface SubCategory ()

@property NSMutableArray* products;

@end

@implementation SubCategory

- (instancetype)init{
    self = [super init];
    if (self) {
        self.products = [[NSMutableArray alloc] init];
    }
    return self;
}


- (NSInteger) productsCount{
    return [self.products count];
}

- (void) addProduct:(Product*) product{
    if (product && [product isKindOfClass:[Product class]]){
        [self.products addObject:product];
    }
}

- (Product*) productAtIndex:(NSInteger) index{
    if (index > -1 && index < [self productsCount]){
        return self.products[index];
    }
    else{
        return nil;
    }
}

@end
